Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consult BAZEL_CXXOPTS when auto-detecting local CC toolchain. #7074

Closed
wants to merge 1 commit into from

Conversation

PiotrSikora
Copy link
Contributor

This allows for passing -stdlib=libc++ to $CC -E when detecting
cxx_builtin_include_directories in @local_config_cc//:CROSSTOOL,
which is enough to support linking against libc++.

$ clang -E -xc++ - -v

/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
/usr/include/clang/8.0.0/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include

$ clang -E -xc++ - -v -stdlib=libc++

/usr/lib/llvm-8/bin/../include/c++/v1
/usr/include/clang/8.0.0/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include

Signed-off-by: Piotr Sikora piotrsikora@google.com

@hlopko
Copy link
Member

hlopko commented Jan 21, 2019

LGTM! Thanks! Can you pls rebase on top of 2d0e27e pls?

@hlopko hlopko self-assigned this Jan 21, 2019
This allows for passing -stdlib=libc++ to $CC -E when detecting
cxx_builtin_include_directories in @local_config_cc//:CROSSTOOL,
which is enough to support linking against libc++.

$ clang -E -xc++ - -v

 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0
 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
 /usr/include/clang/8.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include

$ clang -E -xc++ - -v -stdlib=libc++

 /usr/lib/llvm-8/bin/../include/c++/v1
 /usr/include/clang/8.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

@hlopko rebased, thanks!

FYI, I've got some pushback against vendoring a custom copy of unix_cc_configure.bzl in Envoy, so we're now rewriting -lstdc++ to -lc++ on-the-fly in cc_wrapper.py instead of using BAZEL_CXXOPTS (see: envoyproxy/envoy#5563).

@hlopko
Copy link
Member

hlopko commented Jan 21, 2019

Thanks! Importing.

@bazel-io bazel-io closed this in a89c7ef Jan 21, 2019
weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this pull request Jan 31, 2019
This allows for passing -stdlib=libc++ to $CC -E when detecting
cxx_builtin_include_directories in @local_config_cc//:CROSSTOOL,
which is enough to support linking against libc++.

$ clang -E -xc++ - -v

 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0
 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
 /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
 /usr/include/clang/8.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include

$ clang -E -xc++ - -v -stdlib=libc++

 /usr/lib/llvm-8/bin/../include/c++/v1
 /usr/include/clang/8.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

Closes bazelbuild#7074.

PiperOrigin-RevId: 230236020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants